import { View, Swiper, SwiperItem } from '@tarojs/components'
import { useAppSelector } from '@/store/hooks'
import { CdnImage } from '@/ui-components'
import './index.scss'


export default function TreasuryHome() {

  const bannerList = useAppSelector(state => state.treasury.userTreasury?.treasuryBannerList)

  if (bannerList) {
    return (
      <View className='treasury-home'>
        <Swiper className='m-normal border-radius-medium treasury-home-banner' autoplay>
          {
            bannerList.map((banner, index) => (
              <SwiperItem key={index} style={{ height: '100%', width: '100%' }}>
                <CdnImage src={banner.image} className='match-parent' />
              </SwiperItem>
            ))
          }
        </Swiper>
    </View>
    )
  }
}
